#include <iostream>
#include <stdio.h>
#include <math.h> 
using namespace std;

int prime(int n){
   for (int i = 2;i<=sqrt(n);i++) {
   	   if (n%i==0){
   	   	  return 1;
   	   }
   }
   return 0;
}


/* run this program using the console pauser or add your own getch, system("pause") or input loop */

int main(int argc, char** argv) {
	
	int a = 0;
	int n = 0;
	cout << "请输入n: ";
	cin >> n;
	cout << "\n小于等于"<<n<<"的素数\n";
	int j = 0;
	while(a<=n){
		if (prime(a)==0){
			if (j>=10){
				j=0;
				printf("\n");
			}
			j++;
			printf("%4d",a); 
		}
		a++;
	}
//	prime(n);
	return 0;
}